var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
  camelize: () => camelize,
  createNamespace: () => createNamespace,
  createUniqueId: () => createUniqueId,
  debounce: () => debounce,
  doSleep: () => doSleep,
  isInnerRoute: () => isInnerRoute,
  isPromiseLike: () => isPromiseLike,
  kebabCase: () => kebabCase,
  padNumber: () => padNumber,
  parseTimeData: () => parseTimeData,
  resolveAspectRatio: () => resolveAspectRatio,
  roundNumber: () => roundNumber,
  validatePhoneNumber: () => validatePhoneNumber
});
module.exports = __toCommonJS(stdin_exports);
var import_fan_utils = require("fan-utils");
const isPromiseLike = import_fan_utils.isPromiseLike;
const camelize = import_fan_utils.camelize;
const kebabCase = import_fan_utils.kebabCase;
const roundNumber = import_fan_utils.roundNumber;
const padNumber = import_fan_utils.padNumber;
const debounce = import_fan_utils.debounce;
const validatePhoneNumber = import_fan_utils.validatePhoneNumber;
function createNamespace(name) {
  const prefixedName = `fan-${name}`;
  return [camelize(prefixedName, true)];
}
function createUniqueId(opt) {
  return "" + ((opt == null ? void 0 : opt.prefix) || "") + Math.floor(Math.random() * 1e6).toString(36);
}
function resolveAspectRatio(ar) {
  if (typeof ar === "string") {
    if (ar.includes("/") || ar.includes(":")) {
      const [a, b] = ar.replace("/", ":").split(":");
      return Number(a) / Number(b);
    }
    return Number(ar);
  }
  return ar;
}
function isInnerRoute(url) {
  if (!url || url.startsWith("http") || url.startsWith("alipay"))
    return false;
  return true;
}
const doSleep = (time = 0) => {
  return new Promise((resolve) => {
    setTimeout(() => resolve(true), time);
  });
};
const parseTimeData = (time, hasDays = true) => {
  const SECOND = 1e3;
  const MINUTE = 60 * SECOND;
  const HOUR = 60 * MINUTE;
  const DAY = 24 * HOUR;
  time = time || 0;
  let days = "00";
  let hours = "00";
  if (hasDays) {
    days = padNumber(Math.floor(time / DAY));
    hours = padNumber(Math.floor(time % DAY / HOUR));
  } else {
    hours = padNumber(Math.floor(time / HOUR));
  }
  const minutes = padNumber(Math.floor(time % HOUR / MINUTE));
  const seconds = padNumber(Math.floor(time % MINUTE / SECOND));
  const milliseconds = Math.floor(Math.floor(time % SECOND) / 100);
  return {
    days,
    hours,
    minutes,
    seconds,
    milliseconds
  };
};
